package com.d3works.apps.base.common;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Caculate {

  public static BigDecimal multiply(BigDecimal a, BigDecimal b, int scale) {
    if (a == null || b == null) {
      return BigDecimal.ZERO;
    }
    BigDecimal r = a.multiply(b);
    return r.setScale(scale, RoundingMode.CEILING);
  }

  public static BigDecimal multiply(BigDecimal a, BigDecimal b) {
    return multiply(a, b, 2);
  }
}
